package dobest.ray.com.jiongjiong.activity.action.selftest.NearVision;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import dobest.ray.com.jiongjiong.R;
import dobest.ray.com.jiongjiong.activity.BaseActivity;
import dobest.ray.com.jiongjiong.views.NavigationBar;

/**
 * Created by Ray on 2016/3/24.
 * https://github.com/ray0807
 */
public class NearVisionGuildActivity extends BaseActivity implements View.OnClickListener {
    private static int visionType = 0;//0近视力 1裸眼远视力2
    private static final String VISION_TYPE = "vision_type";
    private ImageView iv_near_guild_1;
    private TextView tv_distace_notice;

    public static void startVisionGuildActivity(Context context, int visionType) {
        Intent intent = new Intent(context, NearVisionGuildActivity.class);
        intent.putExtra(VISION_TYPE, visionType);
        context.startActivity(intent);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_near_vision_guild);
        findViews();
        init();
        addListeners();
    }


    @Override
    public void findViews() {
        navi = (NavigationBar) findViewById(R.id.navi);
        navi.setTitle("近视测试说明");
        navi.setBackListener(R.mipmap.img_back, "");
        navi.setTextRight("下一步", this);
        navi.setTextRightColor(getResources().getColor(R.color.white));
        visionType = getIntent().getIntExtra(VISION_TYPE, 0);

        iv_near_guild_1 = (ImageView) findViewById(R.id.iv_near_guild_1);
        tv_distace_notice = (TextView) findViewById(R.id.tv_distace_notice);
    }

    @Override
    public void init() {
        switch (visionType) {
            case 0:
                iv_near_guild_1.setImageResource(R.mipmap.img_near_vision_guild);
                tv_distace_notice.setText(getResources().getString(R.string.near_vision_cotice));
                break;
            case 1:
                iv_near_guild_1.setImageResource(R.mipmap.img_3m_vision_guild);
                tv_distace_notice.setText(getResources().getString(R.string.near_vision_3m_cotice));
                break;

        }
    }

    @Override
    public void addListeners() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ll_text_right:
                CheckRightEyeGuildActivity.startEyeGuildActivity(this, true, visionType == 0 ? false : true);
                break;

        }
    }
}
